/*
 * Copyright (c) 2010 Network Security Lab (NSL), Department of Electrical
 *                    Engineering, University of Washington
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 as
 * published by the Free Software Foundation;
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 *
 * Author: He Wu mdzz@uw.edu
 */

/**
 * @file sensor.h
 * @brief Sensor packet handler.
 */

#ifndef SENSOR_H
#define SENSOR_H

#include "network.h"

/******************************************************************************/

#define BLUE    0 //!< system error
#define GREEN   1 //!< lots of movement
#define YELLOW  2 //!< little movement
#define RED     3 //!< no movement

#define SENSOR_SAMPLE_SIZE 5 //!< number of sensor sample to keep
#define SENSOR_STATUS_REPORT_INTERVAL 9800000 //!< sensor status report interval, in us

//
#define sensor_debug 1

/******************************************************************************/

/**
 * @brief Handles sensor packets sent from BSN node at locationing node.
 * @param in_pkt Pointer to packet received.
 */
void sensor_pkt_handler(packet *in_pkt);

/**
 * @brief Reports sensor status to base node.
 *
 * Sensor status to report is reset to @see BLUE after each report.
 */
void report_status_to_base();

/**
 * @brief Prints content of health data packets at base node.
 * @param in_pkt Pointer to packet received.
 */
void health_pkt_handler(packet *in_pkt);

#endif
